/*
 * 统计正整数中指定数字的个数（4分）
 */

#include <stdio.h>

int find_matched(int test, int match_case) {
	int matched_times = 0;

	do {
		if (match_case == test % 10) {
			++matched_times;
		}

		test /= 10;
	} while (test % 10 > 0);

	return matched_times;
}

int main() {
	setbuf(stdout, NULL);

	int input, flag;

	printf("Input m,n:\n");
	scanf("%d,%d", &input, &flag);

	printf("%d\n", find_matched(input, flag));

	return 0;
}
